// i.d(t, { vP: () => r, Xk: () => o, jJ: () => a, fY: () => l })
import funcUtil from "./func.util"
import imgWork from "./img.work"
let s: any = null
export const encodeRenderTarget = async (e, t?) => {
  const n = new Uint8Array(e.width * e.height * 4)
  if ((e.readRenderTargetData(n), !s)) {
    s = imgWork.createJpegEncodeWorker()
  }
  const r = n.buffer,
    o = await s.exec(
      {
        data: r,
        width: e.width,
        height: e.height,
        options: { exif: t, quality: 85, flipY: !0 }
      },
      [r]
    )
  return new Uint8Array(o.data)
}
export const createBlob = e => new Blob([e], { type: "image/jpeg" })
export const jpegAsBase64 = e => "data:image/jpg;base64," + funcUtil.base64Str(e)
export const getXmp = (e, t, i, n) =>
  'http://ns.adobe.com/xap/1.0/\0<?xpacket begin="ï»¿" id="W5M0MpCehiHzreSzNTczkc9d"?><x:xmpmeta xmlns:x="adobe:ns:meta/"><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><rdf:Description rdf:about="" xmlns:GPano="http://ns.google.com/photos/1.0/panorama/"><GPano:CroppedAreaImageHeightPixels>' +
  t +
  "</GPano:CroppedAreaImageHeightPixels><GPano:CroppedAreaImageWidthPixels>" +
  e +
  "</GPano:CroppedAreaImageWidthPixels><GPano:CroppedAreaLeftPixels>0</GPano:CroppedAreaLeftPixels><GPano:CroppedAreaTopPixels>0</GPano:CroppedAreaTopPixels><GPano:FullPanoHeightPixels>" +
  t +
  "</GPano:FullPanoHeightPixels><GPano:FullPanoWidthPixels>" +
  e +
  "</GPano:FullPanoWidthPixels><GPano:ProjectionType>equirectangular</GPano:ProjectionType><GPano:UsePanoramaViewer>True</GPano:UsePanoramaViewer><GPano:InitialViewHeadingDegrees>" +
  i +
  "</GPano:InitialViewHeadingDegrees><GPano:InitialViewPitchDegrees>" +
  n +
  '</GPano:InitialViewPitchDegrees><GPano:CaptureSoftware>Matterport Camera</GPano:CaptureSoftware><GPano:StitchingSoftware>Matterport Cloud</GPano:StitchingSoftware></rdf:Description></rdf:RDF></x:xmpmeta><?xpacket end="w"?>'
